package com.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.passPort;
import com.dao.staffDao;

/**
 * Servlet implementation class addPassPort
 */
@WebServlet("/addPassPort.do")
public class addPassPort extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public addPassPort() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//response.getWriter().append("Served at: ").append(request.getContextPath());
		String sid = request.getParameter("sid");
		String id = request.getParameter("id");
		String kind = request.getParameter("kind");
		String startdate = request.getParameter("startdate");
		String enddate = request.getParameter("enddate");
		String returndate = request.getParameter("returndate");
		
		passPort p = new passPort();
		p.setEnddate(enddate);
		p.setSid(Integer.parseInt(sid));
		p.setKind(kind);
		p.setPid(id);
		p.setStartdate(startdate);
		p.setReturndate(returndate);
		System.out.println(p);
		staffDao dao = new staffDao();
		dao.addPassPort(p);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
